package demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import demo.Interceptor.SecurityInterceptor;

@Configuration
public class MVCConfig implements WebMvcConfigurer{
	
	@Bean
    public SecurityInterceptor securityInterceptor() {
        return new SecurityInterceptor();
    }
	
	@Override
    public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(securityInterceptor())
			.excludePathPatterns("/login")
			.excludePathPatterns("/logout") 
			.excludePathPatterns("/error")
			.addPathPatterns("/**");
    }
	
	
}
